package com.ssm.tsj.controller;


import com.ssm.common.mapper.BackstageUserMapper;
import com.ssm.common.pojo.BackstageUser;
import com.ssm.tsj.service.LoginService;
import com.ssm.tsj.vo.MenuMapVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin
public class LoginController {

    @Resource
    private BackstageUserMapper backstageUserMapper;

    @Resource
    private LoginService loginService;


    //登录
    @ResponseBody
    @RequestMapping("/login.action")
    public boolean login(@RequestBody BackstageUser backstageUser){
       int i=backstageUserMapper.login(backstageUser);
        System.out.println(i);
        return i>0;
    }

    //查询菜单
    @ResponseBody
    @RequestMapping("/menu.action")
    public List<MenuMapVo> menu() throws Exception {

        return loginService.menu();
    }
}
